<template>
	<view :class="currentTheme">
		<!-- 		<index-header title="首页" :offsetTop="offsetTop" >
			<view class="u-margin-left-52 u-flex u-col-top" v-if="loginForm.uid" slot="content">
				<item-image :img="loginForm.avatar" type="1" size="96"></item-image>
				<view class="u-margin-left-30">
					<view class="u-font-30 text-white u-margin-bottom-18 nickname u-line-1">{{ loginForm.nickname }}</view>
					<view class="u-flex u-col-top">
						<text class="u-font-24 u-margin-right-30 store-name" v-if="loginForm.storeName && loginForm.userType != 'issue'">{{ loginForm.storeName }}</text>
						<view class="user-auth" v-if="loginForm.userAuthenticate > -1" :class="{ active: loginForm.userAuthenticate == 2 }" @click="authTo">
							{{ loginForm.userAuthenticate == 2 ? '已' : '待' }}认证
						</view>
					</view>
				</view>
			</view>
			<view class="header-box-border u-position-absolute"></view>
		</index-header> -->
		<index-header-color title="首页" :offsetTop="offsetTop">
			<view
				slot="content"
				class="index-header-color"
				:style="loginForm.uid && bannerList ? 'height: 610rpx;' : !loginForm.uid && bannerList ? 'height: 470rpx;' : 'height: 210rpx;'"
			>
				<view class="u-margin-left-32 u-flex u-col-top" v-if="loginForm.uid">
					<item-image :img="loginForm.avatar" type="1" size="96"></item-image>
					<view class="u-margin-left-30">
						<view class="u-font-30 text-black u-margin-bottom-18 nickname u-line-1">{{ loginForm.nickname }}</view>
						<view class="u-flex u-col-top">
							<text class="u-font-24 u-margin-right-30 text-white-black-reversal" v-if="loginForm.storeName && loginForm.userType != 'issue'">{{ loginForm.storeName }}</text>
							<text class="u-font-24 u-margin-right-30  text-white-black-reversal" v-if="loginForm.userType == 'issue'">发行用户</text>
							<view class="user-auth" v-if="loginForm.userAuthenticate > -1" :class="{ active: loginForm.userAuthenticate == 2 }" @click="authTo">
								{{ loginForm.userAuthenticate == 2 ? '已' : '待' }}认证
							</view>
						</view>
					</view>
				</view>

				<view class="swiper-index"><u-swiper :list="bannerList" height="260" width="640" bg-color="#161324" border-radius="26" mode="dot" @click="getSwiperIndex"></u-swiper></view>
			</view>
		</index-header-color>
		<view class="u-padding-left-32 u-padding-right-32 u-padding-bottom-32">
			<view class="u-margin-bottom-24">
				<!-- 店家第一部分 -->
				<view v-if="isStore">
					<view class="u-margin-bottom-24" @click="goStoreLoading" v-if="storeLoading">
						<item-box padding="0" radius="27">
							<view class="u-flex u-padding-left-20 u-padding-top-26">
								<view class="u-padding-bottom-26"><u-icon name="cebenzhong" custom-prefix="index-custom-icon" color="#765CFE" size="30" /></view>
								<view class="u-flex u-flex-1 u-row-between u-margin-left-20 u-padding-bottom-26 u-padding-right-20 ">
									<text class="row-title u-font-28 text-bold">正在游戏中...</text>
									<view class="u-flex">
										<text class="u-font-22 u-margin-right-18 read-title">点击查看</text>
										<u-icon name="arrow-right" size="20" color="#999ABD"></u-icon>
									</view>
								</view>
							</view>
						</item-box>
					</view>
					<view class="u-padding-bottom-25 box-title u-font-32 u-swiper-margin-bottom text-bold">门店管理</view>
					<view>
						<view class="u-flex u-row-between">
							<item-image
								:img="`${aliosCdn}/larp/store-index-${currentTheme}/mystore.png`"
								width="333"
								height="333"
								@click="storePath('/pagesA/storeList/storeList')"
								:showLoading="false"
							/>
							<item-image
								:img="`${aliosCdn}/larp/store-index-${currentTheme}/personnel.png`"
								width="333"
								height="333"
								@click="storePath('/pagesA/storePeople/storePeople')"
								:showLoading="false"
							/>
						</view>
						<view class="u-flex u-row-between u-margin-top-20">
							<item-image
								:img="`${aliosCdn}/larp/store-index-${currentTheme}/gameOrder.png`"
								width="220"
								height="200"
								@click="storePath('/pagesA/storeLarpManager/storeLarpManager')"
								:showLoading="false"
							/>
							<view class="u-position-relative">
								<view class="notice" v-if="showRedNotice({ noticeType: 'storeGatherGame' })"></view>
								<item-image
									:img="`${aliosCdn}/larp/store-index-${currentTheme}/gameManager.png`"
									width="220"
									height="200"
									@click="gameManager({ noticeType: 'storeGatherGame' })"
									:showLoading="false"
								/>
							</view>
							<item-image
								:img="`${aliosCdn}/larp/store-index-${currentTheme}/profit.png`"
								width="220"
								height="200"
								@click="storePath('/pagesA/storeIncomeStatistics/storeIncomeStatistics')"
								:showLoading="false"
							/>
						</view>
					</view>
				</view>
				<!-- 发行第一部分 -->
				<template v-if="!isStore">
					<view class="u-padding-bottom-25 box-title u-font-32 text-bold">我的剧本</view>
					<view class="u-flex u-row-between">
						<item-image
							:img="`${aliosCdn}/larp/issue-index-${currentTheme}/larpManager.png`"
							width="333"
							height="333"
							@click="issuePath('/pagesA/larpManager/larpManager')"
							:showLoading="false"
						/>
						<item-image :img="`${aliosCdn}/larp/issue-index-${currentTheme}/submit.png`" width="333" height="333" @click="commitLarp" :showLoading="false" />
					</view>
				</template>
			</view>

			<!-- 第二部分 -->
			<view v-for="(item, index) in auth" :key="index" class="u-margin-bottom-44">
				<indexTabList :showTitle="item.title !== '展会'" :title="item.title" :list="item.list" :subTitle="item.subTitle" @goPath="tabClick">
					<!-- 店家-剧本管理 -->
					<view slot="tips" v-if="item.tips" class="u-padding-bottom-20 tips">{{ item.tips }}</view>
					<!-- <view class="u-padding-left-20 u-margin-right-20 u-margin-top-10 u-position-relative" v-if="item.title === '剧本管理' && loginForm.clerkRole != 'DM'" slot="inner-slot">
						<item-image :img="`${aliosCdn}/larp/store-index-${currentTheme}/storeList.png`" width="646" height="122" :showLoading="false" />
						<view class="go-store u-position-absolute">
							<item-btn @click="larpStore" width="136" height="40"><text class="u-font-20">立即前往</text></item-btn>
						</view>
					</view> -->
					<view
						class="u-padding-left-20 u-padding-right-20 u-margin-top-10 u-position-relative u-flex u-row-between"
						v-if="item.title === '剧本管理' && loginForm.clerkRole != 'DM'"
						slot="inner-slot"
					>
						<view><item-image :img="`${aliosCdn}/larp/store-index-${currentTheme}/storeLeft.png`" width="306" height="120" :showLoading="false" @click="larpStore" /></view>
						<view>
							<item-image :img="`${aliosCdn}/larp/store-index-${currentTheme}/storeRight.png`" width="306" height="120" :showLoading="false" @click="toExperienceStore" />
						</view>
					</view>

					<!-- 开本视频 -->
					<view v-if="item.title == '展会' && storeProducts && storeProducts.length>0" class="u-margin-top-40 u-margin-bottom-20">
						<view class="u-flex content-desc-item storeProducts-title u-padding-bottom-20" style="justify-content: space-between">
							<view class="u-row-between"><view class="text-bold u-font-32">开本视频</view></view>
							<view class="u-flex share u-position-relative" @click="goOpenVedio()">
								<text style="color: #333">查看全部</text>
								<u-icon name="arrow-right" size="20" color="#1A1A1A"></u-icon>
							</view>
						</view>
						<view class="u-padding-bottom-20">
							<item-box padding="0">
								<view>
									<scroll-view scroll-x :scroll-y="false" class="scroll-view-list">
										<view class="u-flex u-row-left u-margin-left-10">
											<view v-for="(c1, index1) in storeProducts" :key="index1" class="u-margin-top-20 u-margin-buttom--20 u-padding-left-10 jianxi" @click="dmClick(c1)">
												<item-image :img="c1.image" :width="250" :height="176" :radius="26" />
												<view class="storeProducts-name">
													<text>{{c1.createName ? c1.createName.substring(0,5):''}}</text>
													<view>
														<u-icon name="yidongduanicon-" custom-prefix="custom-icon" color="#fff" size="26" />
														<text>{{ c1.browse || 0}}</text>
													</view>
												</view>
											</view>
										</view>
									</scroll-view>
								</view>
							</item-box>
						</view>
					</view>
					<!-- 开本视频 end -->

					<!-- 发行--展会--验票模块 -->
					<view v-if="item.title == '展会'">
						<view class="u-margin-bottom-24 u-flex u-row-between">
							<view class="u-flex">
								<view class="box-title u-font-32 text-bold">展会</view>
								<view class="u-font-22 content-desc-item u-margin-left-10" v-if="loginForm.exhibitName">
									{{ loginForm.exhibitName || ''}}
								</view>
							</view>
							<!-- <view @click="qrcode">
								<u-icon name="saoyisao" custom-prefix="index-custom-icon" size="20" color="#765CFE"></u-icon>
								<text class="u-font-20 text-color-txtTheme u-margin-left-6">扫一扫验票</text>
							</view> -->
						</view>
						<view class="u-flex u-row-between u-margin-bottom-20">
							<!-- <item-image :img="`${aliosCdn}/larp/issue-index-${currentTheme}/validateticket.png`" width="333" height="158" @click="checkBill" :showLoading="false" />
							<item-image :img="`${aliosCdn}/larp/issue-index-${currentTheme}/buyTicket.png`" width="333" height="158" @click="buyBill" :showLoading="false" /> -->
							<item-image :img="`${aliosCdn}/larp/issue-index-${currentTheme}/buyTicket2.png`" width="214" height="158" @click="checkBill" :showLoading="false" />
							<item-image :img="`${aliosCdn}/larp/issue-index-${currentTheme}/validateticket2.png`" width="214" height="158" @click="buyBill" :showLoading="false" />
							<item-image :img="`${aliosCdn}/larp/issue-index-${currentTheme}/calendar.png`" width="214" height="158" @click="calendar" :showLoading="false" />
						</view>
					</view>
					<!-- 正在测本中 -->
					<view class="u-margin-bottom-24" @click="goLoading" v-if="isLoading && item.title == '展会'" slot="loading">
						<item-box padding="0" radius="27">
							<view class="u-flex u-padding-left-20 u-padding-top-26">
								<view class="u-padding-bottom-26"><u-icon name="cebenzhong" custom-prefix="index-custom-icon" color="#765CFE" size="30" /></view>
								<view class="u-flex u-flex-1 u-row-between u-margin-left-20 u-padding-bottom-26 u-padding-right-20 ">
									<text class="row-title u-font-28 text-bold">正在测本中...</text>
									<view class="u-flex">
										<text class="u-font-22 u-margin-right-18 read-title">点击查看</text>
										<u-icon name="arrow-right" size="20" color="#999ABD"></u-icon>
									</view>
								</view>
							</view>
						</item-box>
					</view>
				</indexTabList>
			</view>

			<!-- 服务活动 -->
			<view class="u-margin-bottom-44">
				<view class="box-title  text-bold u-font-32 u-margin-bottom-24">服务&活动</view>
				<item-box padding="0">
					<view class="u-flex u-padding-left-20 u-padding-top-30" @click="toNoPathFun()">
						<view class="u-padding-bottom-30"><u-icon name="yaoqingdianjia" custom-prefix="index-custom-icon" color="#765CFE" size="30" /></view>
						<view class="u-flex u-flex-1 u-row-between u-margin-left-20 u-padding-bottom-30 u-border-bottom  u-padding-right-20 ">
							<text class="row-title u-font-28">服务套餐</text>
							<u-icon name="arrow-right" size="20" color="#999ABD"></u-icon>
						</view>
					</view>
					<view class="u-flex u-padding-left-20 u-padding-top-30"  @click="toNoPathFun()">
						<view class="u-padding-bottom-30"><u-icon name="paihangbang" custom-prefix="index-custom-icon" color="#765CFE" size="30" /></view>
						<view class="u-flex u-flex-1 u-row-between u-margin-left-20  u-padding-bottom-30  u-padding-right-20 ">
							<text class="row-title u-font-28">行业活动</text>
							<u-icon name="arrow-right" size="20" color="#999ABD"></u-icon>
						</view>
					</view>
				</item-box>
			</view>
			<!-- 其他 -->
			<view class="u-margin-bottom-44">
				<view class="box-title text-bold u-font-32 u-margin-bottom-24">其他</view>
				<item-box padding="0">
					<view class="u-flex u-padding-left-20 u-padding-top-30" @click="shareUser(isStore ? '邀请玩家' : '邀请店家')">
						<view class="u-padding-bottom-30"><u-icon name="yaoqingdianjia" custom-prefix="index-custom-icon" color="#765CFE" size="30" /></view>
						<view class="u-flex u-flex-1 u-row-between u-margin-left-20 u-padding-bottom-30 u-border-bottom  u-padding-right-20 ">
							<text class="row-title u-font-28">{{ isStore ? '邀请玩家' : '邀请店家' }}</text>
							<u-icon name="arrow-right" size="20" color="#999ABD"></u-icon>
						</view>
					</view>
					<view class="u-flex u-padding-left-20 u-padding-top-30" @click="ranking">
						<view class="u-padding-bottom-30"><u-icon name="paihangbang" custom-prefix="index-custom-icon" color="#765CFE" size="30" /></view>
						<view class="u-flex u-flex-1 u-row-between u-margin-left-20  u-padding-bottom-30  u-padding-right-20 ">
							<text class="row-title u-font-28">排行榜</text>
							<u-icon name="arrow-right" size="20" color="#999ABD"></u-icon>
						</view>
					</view>
				</item-box>
			</view>
		</view>
		<!-- 剧烈购 -->
		<view class="u-position-fixed julie-go" @click="julieGo" v-if="isStore && twoEleven">
			<u-image :fade="false" :showLoading="false" src="https://larp-gbo.oss-cn-chengdu.aliyuncs.com/wx/shuangsyi.png" width="155" height="111"></u-image>
		</view>
		<view v-show="showModal" class="activity-show-modal u-position-fixed">
			<u-mask :show="showModal" :mask-click-able="false" :zoom="false" :zIndex="333"></u-mask>
			<view class=" activityImage u-position-relative"><u-image src="https://larp-gbo.oss-cn-chengdu.aliyuncs.com/wx/activity1111.png" mode="widthFix"></u-image></view>
			<view class="close u-position-absolute" @click="showModal = false">
				<u-image src="https://larp-gbo.oss-cn-chengdu.aliyuncs.com/wx/remove1111.png" mode="widthFix" width="57" height="57"></u-image>
			</view>
			<view class="buy-btn-image u-position-absolute" @click="julieGo">
				<u-image src="https://larp-gbo.oss-cn-chengdu.aliyuncs.com/wx/buy1111.png" mode="widthFix" :width="316" height="100"></u-image>
			</view>
		</view>

		<!-- 开屏广告 -->
		<view class="advertising">
			<u-mask :show="show">
				<view class="warp">
					<view class="rect" @tap.stop>
						<image :src="content.imgUrl + '?x-oss-process=image/resize,w_700/quality,Q_100'" mode="" @click="linkUrl"></image>
						<view class="ignore" @click="isShow">
							<text v-show="countdown">{{ countdown }}</text>
							跳过
						</view>
						<view class="advertising_label">广告</view>
					</view>
				</view>
			</u-mask>
		</view>
	</view>
</template>

<script>
import indexTabList from './indexTabList.vue';
import { mapGetters } from 'vuex';
import { add, getDetail, getList } from '@/api/crud.js';
import dayjs from 'dayjs';
import data from '@/data/index.js';
// import indexHeader from '@/components/indexHeader/indexHeader.vue';
import indexHeaderColor from '@/components/indexHeaderColor/indexHeaderColor.vue';
import { getAdvertising, getOpenVedioList } from '@/api/advertising.js';
// import imageMaskTitle from '../../pagesA/exhibitionCalender/components/imageMaskTitle';
export default {
	components: {
		indexTabList,
		// indexHeader,
		indexHeaderColor
		// imageMaskTitle
	},
	data() {
		return {
			bgImg: '../../../../static/images/index.png', // 首页背景图片
			countdown: 3, // 广告弹层倒计时
			advertising: '', // 广告图片
			show: false,
			content: {
				linkUrl: '', // 跳转链接
				linkType: '',
				id: ''
			},
			linkType: 1, // 广告类型
			storeLoading: false, // 是否显示正在游戏中
			isLoading: false, // 是否显示正在测本中
			driveCarId: '', // 测本id
			apiModule: 'shopApi',
			gameId: '', // 组局id
			showModal: false, //是否显示双十一弹框
			twoEleven: false, // 是否显示双十一内容
			offsetTop: 0,
			bannerList: [
				{
					image: 'https://larp-gbo.oss-cn-chengdu.aliyuncs.com/wx/julie.png'
				}
			],
			storeProducts: []
		};
	},
	computed: {
		// 是否为店家身份
		isStore() {
			return this.userType !== 'issue';
		},
		// 用户类型
		userType() {
			return this.loginForm.userType || 'store';
		},
		...mapGetters(['lastLook']),
		// 显示的模块入口
		auth() {
			let { userType } = this;
			let arr = data.pageIndexRoute[userType];
			arr[1].subTitle = this.loginForm.exhibitName;
			arr = arr.map(val => {
				if (val.title === '剧本管理' && this.loginForm.clerkRole === 'DM') {
					val.btnList = [];
				}
				return val;
			});
			return arr;
		}
	},
	onPageScroll(e) {
		this.offsetTop = e.scrollTop;
	},
	onLoad(e) {
		this.getAdvertising();
		uni.setStorageSync('onlyShowOneTime', 1);
		if (this.loginForm && this.loginForm.hxPassword) {
			const { hxPassword, hxUsername } = this.loginForm;
			getApp().globalData.login({ hxPassword, hxUsername });
		}
		// 分享所有页面由首页跳过去 好返回首页 不退出小程序
		if (Object.keys(e).length != 0) {
			//分享后身份判断
			if (this.loginForm && this.loginForm.userAuthenticate == 1) {
				this.$u.toast('审核中，请耐心等待');
				return false;
			}

			//创建门店
			if (!this.changeValid(e.src)) return false;
			setTimeout(() => {
				// 延时确保dom已渲染, 不使用$nextclick
				let param = '';
				if (e.param) {
					param = JSON.parse(e.param);
				}
				this.$u.route({
					url: `/${e.src}`,
					params: param
				});
			}, 100);
			setTimeout(() => {
				this.shareLogin(e.src, e.userType);
			}, 300);
		}
		getList({ page: 0, size: 10 }, 'wxCarousel', 'sns', 'getWxCarousel').then(res => {
			if (res.content.length > 0) this.bannerList = res.content.map(val => ({ image: val.img, ...val }));
		});
		this.getOpenVedioList(); // 开本视频
	},
	async onShow() {
		this.findCar();
		this.findStoreCar();
		if (this.token) this.$store.dispatch('getInfo');
		//判断是否应该显示活动 未登录状态 或者store身份 且不是dm身份 才展示
		console.log(this.isStore && this.loginForm.clerkRole !== 'DM');
		if (!this.loginForm.uid || (this.isStore && this.loginForm.clerkRole !== 'DM')) {
			const getParams = await getDetail('', 'getAppParam', 'shopApi');
			this.twoEleven = getParams.twoEleven;
			if (!getParams.twoEleven) return false;
			if (!this.lastLook) {
				this.$store.dispatch('setLastLook', dayjs().valueOf()); // 设置当前时间
				this.showModal = true;
				return false;
			}
			if (this.lastLook) {
				this.showModal = !dayjs(dayjs(this.lastLook).format('YYYY-MM-DD 23:59:59')).isAfter(dayjs());
				this.showModal && this.$store.dispatch('setLastLook', dayjs().valueOf());
			}
		} else {
			this.twoEleven = false;
		}
	},
	watch: {
		countdown: {
			handler(val) {
				if (val === 0) {
					setTimeout(() => {
						this.show = false;
					}, 300);
				}
			}
		}
	},
	methods: {
		linkUrl() {
			this.linkUrlHandle(this.content);
			this.show = false;
		},
		isShow() {
			this.show = false;
		},
		// let res = await getAdvertising()
		// console.log(res,'我是一只老鼠')
		async getAdvertising() {
			try {
				let linkType = this.linkType;
				let res = await getAdvertising(linkType);
				this.content = res.content[0] || {};
				this.show = !!res.content.length;
				let timers;
				timers = setInterval(() => {
					this.countdown--;
					if (this.countdown === 0) {
						clearInterval(timers);
					}
				}, 1000);
			} catch (e) {
				let timers;
				timers = setInterval(() => {
					this.countdown--;
					if (this.countdown === 0) {
						clearInterval(timers);
					}
				}, 1000);
			}
		},
		//排行榜
		ranking() {
			this.$u.route({
				url: '/pagesA/rankingList/index'
			});
		},
		//正在测本
		findCar() {
			if (this.loginForm.uid) {
				add('', 'driveCar', this.apiModule, `getUserRunningCar/${this.loginForm.uid}`).then(res => {
					this.isLoading = res.length > 0;
					if (res.length == 1) this.driveCarId = res[0].id;
				});
			}
		},
		//门店正在组局中
		findStoreCar() {
			if (this.loginForm.storeId) {
				getDetail({}, 'gatherGame', this.apiModule, `findRunningByStore/${this.loginForm.uid}`).then(res => {
					this.storeLoading = res.length > 0;
					if (res.length == 1) this.gameId = res[0].id;
				});
			}
		},
		//点击跳转到发车计时界面
		goLoading() {
			if (this.driveCarId) {
				this.goPath({
					url: '/pagesA/carTime/carTime',
					params: {
						id: this.driveCarId
					}
				});
			} else {
				this.goPath('/pagesA/carTime/carList');
			}
		},
		//跳转到门店计时界面
		goStoreLoading() {
			this.goPath('/pagesA/carTime/gameList');
		},
		btnClick(item) {
			const fn = item.function;
			this[fn] && this[fn]();
		},

		//店家端验证进入我的剧本 需要有门店
		changeValid(url) {
			const { storeNumber } = this.loginForm;
			if (url.includes('larpManager') && storeNumber === 0) {
				this.$u.toast('请先创建门店再进行操作');
				return false;
			}
			return true;
		},
		//展会模块和剧本管理模块跳转验证
		async tabClick(item) {
			try {
				const { icon, title, url, label } = item.params;
				console.log(item.params);
				if (url != 'larpList' || (this.loginForm.userType == 'issue' && url == 'larpList')) {
					//查看店家端参展剧本不需要登录
					await this.loginValidate();
					//发行端参展剧本管理 只要验了票就可以进入 （12.2 测试说还是需要参展信息）
					if (title === '展会') {
						const whiteUrl = ['order', 'want', 'replyManager'];
						!['exhibitList', ...whiteUrl].includes(url) && (await this.isBillVaildate()); //是否验票
						!['larpSetting', 'exhibitList', ...whiteUrl].includes(url) && (await this.exhibitValidate()); //是否完善参展信息
					} else {
						//2021年9月22日14点12分修改原因：未入驻也可以进入剧本商城、买本订单和售后订单 进入剧本商城列表会根据用户当前是否入驻返回商品的原价或者活动价格
						//await this.planformValidate() //入驻
					}
				}
				const { isClerk, storeNumber } = this.loginForm;
				if (title === '剧本管理' && this.loginForm.clerkRole === 'DM' && ['order', 'afterSale', 'groupBuy'].includes(url)) {
					//如果是员工 则不能进入买本订单  售后管理 团购
					this.$u.toast('无权限，请联系店长或管理员修改');
					return false;
				}
				if (title === '剧本商城') {
					if (this.loginForm.userAuthenticate === 1) {
						//审核中提示
						this.isAuth();
						return false;
					}
					if (this.loginForm.userAuthenticate !== 2) {
						await this.userAuthenticateValidate(); //未认证弹框
						return false;
					}
				}
				if (item.url.includes('larpManager') && storeNumber === 0) {
					this.$u.toast('请先创建门店再进行操作');
					return false;
				}
				this.goPath(item);
			} catch (e) {
				//TODO handle the exception
			}
		},
		//跳转验证
		goPath(item) {
			if (!item.url) item = { url: item };
			this.$u.route(item);
		},
		async issuePath(url) {
			try {
				await this.planformValidate(); //入驻
				this.goPath(url);
			} catch (e) {
				//TODO handle the exception
			}
		},
		//一键上传
		commitLarp() {
			this.issuePath('/pages/addLarp/addLarp');
		},
		//验票
		checkBill() {
			this.goPath('/pagesA/validateBill/validateBill');
		},
		//购票
		buyBill() {
			this.goPath('/pagesA/validateBill/buyBill');
		},
		calendar() {
			this.goPath('/pagesB/exhibitionCalender/exhibitionCalender');
		},
		//商城列表
		larpStore() {
			this.goPath({
				url: '/pagesA/goodsList/goodsList',
				params: {
					type: 'goods',
					label: '剧本商城'
				}
			});
		},
		//体验商城列表 登录后才能进入
		toExperienceStore() {
			this.loginValidate().then(_ => {
				this.goPath({
					url: '/pagesA/experienceStore/experienceStore',
					params: {
						type: 'goods',
						label: '剧本体验商城'
					}
				});
			});
		},
		//门店模块跳转
		async storePath(url) {
			//判断是否登录 判断是否认证 判断是否有门店
			try {
				const { storeNumber, isClerk, clerkRole, storeId } = this.loginForm;
				const isStoreListUrl = url === '/pagesA/storeList/storeList';
				await this.loginValidate(); //登录
				if (!isClerk) {
					//发行/商家
					await this.planformValidate(); //入驻
					if (this.loginForm.userAuthenticate === 1) {
						//审核中提示
						this.isAuth();
						return false;
					}
					if (this.loginForm.userAuthenticate !== 2) {
						// await this.userAuthenticateValidates(); //未认证弹框
						// return false;
            this.$u.route({
              url:'pagesA/storeList/storeSample'
            })
            return false
					}
				}
				if (clerkRole == 'DM' && isStoreListUrl) {
					url = '/pagesA/storeList/readonlyDetail?id=' + storeId; //如果是dm 直接查看门店详情不查看列表
				}
				if ((url && storeNumber) || isStoreListUrl) {
					//是否有门店
					this.goPath(url);
					return false;
				} else {
					this.$u.toast('请先创建门店再进行操作');
				}
			} catch (e) {
				//TODO handle the exception
			}
		},
		//前往认证
		authTo() {
			if (this.isAuth()) {
				const isIssue = this.loginForm.userType == 'issue';
				const label = isIssue ? '发行' : '店家';
				this.$u.route({
					url: '/pagesA/authPage/authPage',
					params: {
						label: label + '认证',
						authType: isIssue ? 2 : 3
					}
				});
			}
		},
		//是否认证
		isAuth() {
			const isauth = this.loginForm.userAuthenticate;
			if (isauth == 1) {
				//如果是认证中则提示
				this.$u.toast('审核中，请耐心等待');
				return false;
			}
			if (isauth == 2) {
				//已认证无操作
				return false;
			}
			return true;
		},
		//邀请店家 玩家
		async shareUser(label) {
			await this.loginValidate(); //登录
			await this.planformValidate(); //入驻
			this.$u.route({
				url: '/pagesA/shareUser/shareUser',
				params: { label }
			});
		},
		// 跳转剧烈购
		julieGo() {
			this.goPath({
				url: '/pagesA/groupBuy/groupBuy',
				params: {
					title: '剧烈购',
					pageType: '1111' // 双十一的意思
				}
			});
		},
		//扫一扫
		qrcode() {
			uni.scanCode({
				success(res) {}
			});
		},
		//组局订单
		gameManager(item) {
			this.itemClick(item);
			const path = '/pagesA/teamOrder/teamOrder';
			this.storePath(path);
		},
		getSwiperIndex(index) {
			const item = this.bannerList[index];
			this.linkUrlHandle(item);
		},
    // 跳转到该视频详情页
		dmClick(item) {
      this.$u.route({
        url:'pagesA/openScript/openScriptDetail',
        params: {
          id: item.id,
          name: item.name
        }
      })
		},
		// 获取开本视频列表
		async getOpenVedioList() {
			let res = await getOpenVedioList();
			this.storeProducts = (res.content && res.content.length > 0)  ? res.content.slice(0,3) : [] // 首页这里只展示前三个视频
		},
		// 查看开本视频详情
		goOpenVedio(t) {
			this.$u.route({
				url: '/pagesA/openScript/openScriptList'
			});
		},
		//暂未统一
		toNoPathFun(){
			this.$u.toast(`敬请期待`)
		}
	}
};
</script>

<style lang="scss" scoped>
.header-box-border {
	background-color: var(--background-color);
	height: 25rpx;
	bottom: 0;
	left: 0;
	right: 0;
	border-radius: 40rpx 40rpx 0 0;
}
.julie-go {
	right: 0;
	bottom: 267rpx;
	z-index: 333;
}
.activity-show-modal {
	z-index: 335;
	height: 100vh;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
}
.close {
	z-index: 336;
	right: 57rpx;
	top: 170rpx;
}
.buy-btn-image {
	z-index: 336;
	bottom: 100rpx;
	left: 50%;
	transform: translateX(-50%);
}
.activityImage {
	z-index: 334;
}
.go-store {
	right: 16rpx;
	top: 50%;
	transform: translateY(-50%);
}
.row-title,
.read-title {
	color: #4d4d4d;
}
.store-name {
	color: white;
}
.nickname {
	width: 50vw;
	letter-spacing: 2rpx;
}
.user-auth {
	flex: 0 0 133rpx;
	width: 133rpx;
	color: white;
	font-size: 14rpx;
	text-align: center;
	line-height: 30rpx;
	height: 32rpx;
	letter-spacing: 2rpx;
	border-radius: 30px;
	margin-right: 40rpx;
	background: var(--color-lightGrey);
	&.active {
		background: var(--theme-color);
	}
}

.u-swiper-margin-bottom {
	margin-top: 20rpx;
}

.warp {
	position: fixed;
	top: 50%;
	left: 50%;
	//width: 520rpx;
	//height: 988rpx;
	//margin-left: -260rpx;
	// 根据比例换算 高是宽的1.9倍
	width: 43.44vh;
	height: 78.7vh;
	margin-left: -21.72vh;
	margin-top: -35vh;
	// margin:  auto;
	// transform: translate(-50%, -50%);

	.rect {
		position: relative;
		width: 100%;
		height: 100%;
		image {
			width: 100%;
			height: 100%;
			border-radius: 26rpx;
		}
		.ignore {
			width: 178rpx;
			height: 66rpx;
			border-radius: 33rpx;
			position: absolute;
			top: 35rpx;
			right: 23rpx;
			z-index: 9999;
			background-color: rgba(0, 0, 0, 0.6);
			color: #fff;
			font-size: 28rpx;
			line-height: 66rpx;
			text-align: center;
			text {
				// font-size: 36rpx;
				margin-right: 20rpx;
			}
		}
		.advertising_label {
			width: 78rpx;
			height: 32rpx;
			position: absolute;
			left: 17rpx;
			bottom: 23rpx;
			background-color: rgba(0, 0, 0, 0.6);
			color: #999;
			font-size: 22rpx;
			line-height: 32rpx;
			text-align: center;
			border-radius: 16rpx;
		}
	}
}

/deep/ .index-header-color {
	padding-top: 90rpx;
	display: flex;
	flex-direction: column;
	justify-content: flex-end;
}
// 首页轮博图
.swiper-index {
	padding: 0 32rpx;
	margin-top: 40rpx;
	margin-bottom: 20rpx;
}

.jianxi {
	margin-right: 10rpx;
	margin-bottom: -10rpx;
}

.storeProducts-name {
	position: relative;
	top: -36rpx;
	border-radius: 0 0 26rpx 26rpx;
	padding-left: 20rpx;
	padding-right: 20rpx;
	left: 0px;
	color: #fff;
	font-size: 20rpx;
	width: 100%;
	background-color: rgba(0, 0, 0, 0.05);
	display: flex;
	justify-content: space-between;
}
</style>
